package utils;

import com.mchange.v2.c3p0.ComboPooledDataSource;


import javax.sql.DataSource;

import java.sql.Connection;
import java.sql.SQLException;


public class C3p0Helper {
    static ComboPooledDataSource comboPooledDataSource = null;

    static {

            comboPooledDataSource = new ComboPooledDataSource("mySource");
    }


    public static Connection  getConnection(){
        try {
            return comboPooledDataSource.getConnection();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    public static DataSource getDataSource(){
        return comboPooledDataSource;
    }

}
